﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common.Extend;

namespace CTools.Areas.Strs.Controllers
{
    public class SafeController : CTools.Controllers.BaseController
    {
        // GET: Strs/Safe
        /// <summary>
        /// 加密解密
        /// </summary>
        /// <returns></returns>
        public ActionResult Encrypt()
        {
            return View();
        }
        /// <summary>
        /// 生成指定规则的随机密码
        /// </summary>
        /// <returns></returns>
        public ActionResult RandomPwd()
        {
            ViewBag.PwdMinLength = 4;
            ViewBag.PwdMaxLength = 30;
            return View();
        }


        public ActionResult GetRandomPwd(int PwdLength, bool isNumber, bool isSmall, bool isBig, bool isSymbol = false)
        {
            if (PwdLength < 4 || PwdLength > 30)
            {
                doResult.Msg = "长度只能是4到30位的";
            }

            doResult.Data = new Random().ExGenerateRandom(PwdLength);
            return Json(doResult);
        }

    }
}